<?php
/**
 * Created by PhpStorm.
 * User: DELL
 * Date: 2021/3/5
 * Time: 11:57
 */

namespace App\Api\V1\Models;
use Illuminate\Database\Eloquent\Model;

class GoodsType extends Model
{
    protected $table = 'goods_type';
    public $timestamps = false;
    //商品模型添加
    public function addGoodsTypeItem(){
        $data =[
            'type_name'=>'1',
        ];
        $this->status = $data['type_name'];
        if ($this->save()){
            return $this->toArray();
        }
        return false;
    }
    //商品模型修改
    public function setGoodsTypeItem(){
        $data =[
            'type_name'=>'23333',
        ];
        $res = GoodsType::where('goods_type_id',1)->update($data);
        if($res){
            return $this->toArray();
        }
        return false;
    }
    //获取商品模型列表
    public function getGoodsTypeList(){
        return $this->get()->toArray();
    }
    //删除商品模型
    public function delGoodsTypeList(){
        $res = GoodsType::where('goods_type_id',1)->delete();
        if($res){
            return $this->toArray();
        }
        return false;
    }
}